<#assign attribute=getContentAttribute(content.id)/>
<@cms.category id=content.categoryId;category>
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8" />
        <title>${content.title} - ${(category.name)!}</title>
		<meta name="keywords" content="<#list getKeywords(content.title) as a>${a}<#sep>,</#list>"/>
		<meta name="description" content="${(content.description)!}"/>
       <@tools.includePlace path="/common/697054d4-2b69-4476-b4fe-868c61316959.html"/> <#-- header -->
    </head>
    <body class="d-flex flex-column">
        <main class="flex-shrink-0">
            <@tools.includePlace path="/common/0b31f69d-dc03-407b-95af-88be3db0289e.html"/> <#-- nav -->
            <!-- Page Content-->
            <section class="py-5">
                <div class="container px-5 my-5">
                    <div class="row gx-5">
                        <div class="col-lg-12">
                            <article>
                                <header class="mb-4">
                                    <h1 class="fw-bolder mb-1">${content.title}</h1>
                                    <div class="text-muted fst-italic mb-2">${content.publishDate?date}</div>
									<@cms.tag ids=content.tagIds>
										<#list map as k,t>										
                                    <a class="badge bg-secondary text-decoration-none link-light" href="${site.dynamicPath}search/?tagId=${k}">${t.name}</a>
										</#list>
									</@cms.tag>
                                </header>
                                <section class="mb-4 content">
									<@cms.contentFileList contentId=content.id fileTypes='image'>
										<div class="swiper pictures">
											<div class="swiper-wrapper">
												<#list page.list as file>
												<div class="swiper-slide">
													<img src="${(file.filePath)!}" alt="${(file.description)!}"/>
												</div>
												</#list>
											</div>
											<div class="swiper-button-next"></div>
											<div class="swiper-button-prev"></div>
										</div>
										<div thumbsSlider="" class="swiper thumbs pt-3">
											<div class="swiper-wrapper">
												<#list page.list as file>
												<div class="swiper-slide">
													<img src="${(file.filePath)!}" />
												</div>
												</#list>
											</div>
										</div>
									</@cms.contentFileList>
                                </section>
                            </article>
							<div class="text-center mb-3">								
								<#assign maxScores=5/>
								<@sys.configData code="site"><#assign maxScores=(object.max_scores?number)!maxScores/></@sys.configData>
								<span class="scores">
									<#list 1..maxScores as i>
										<a href="javascript:void(0);" title="${i} 分"><span class="icon <#if content.score gte i>icon-scores-star<#else>icon-scores-unstar</#if>"></span></a>
									</#list>
									<#if content.scores gt 0><b>${content.score}</b>分</#if>
									<#if user?has_content>
										<@cms.userScore userId=user.id itemType='content' itemId=content.id>
											<span class="unscores ms-3">我的评分:${object.score} <a href="javascript:void(0);">取消</a></span>
										</@cms.userScore>
									</#if>
								</span>
							</div>
							<#assign pageIndex=1/>
                            <@include path="/fragment/comment.html"/><#-- 评论列表 -->
                        </div>
                    </div>
                </div>
            </section>
        </main>
		<script>
            var itemString="itemType=content&itemId=${content.id}";
			var templatePath='${.current_template_name?keep_after('/')}';
        </script>
        <@tools.includePlace path="/common/704bd033-154c-40f4-a8c5-2d36c092c3fd.html"/> <#-- footer -->
		<script src="${site.sitePath}assets/js/jquery-3.6.4.min.js"></script>
		<script>
			$.getJSON('${site.dynamicPath!}api/contentClick?id=${content.id}', function(data){});

			if($('.scores').find('.unscores').length){
				$('.unscores a').click(function(){
					$.ajax({url:'${site.dynamicPath!}score/unscore?itemId=${content.id}&itemType=content&_csrf=<@_csrfToken/>', success:function(data){
						location.reload();
					}});
				});
			}else{
				$('.scores a').hover(function(){
					$(this).find('span').removeClass('icon-scores-unstar').addClass('icon-scores-star');
					$(this).prevAll().find('span').removeClass('icon-scores-unstar').addClass('icon-scores-star');
				},function(){
					$(this).find('span').removeClass('icon-scores-star').addClass('icon-scores-unstar');
					$(this).prevAll().find('span').removeClass('icon-scores-star').addClass('icon-scores-unstar');
				});
				$('.scores a').click(function(){
					$.ajax({url:'${site.dynamicPath!}score/score?itemId=${content.id}&itemType=content&scores='+($(this).index()+1)+'&_csrf=<@_csrfToken/>', success:function(data){
						location.reload();
					}});
				});
			}

		</script>
    </body>
</html>
</@cms.category>